package com.barradata.app0624.api

import com.example.hfiveandaplication.http.Api
import com.example.hfiveandaplication.http.ParamsFactory
import okhttp3.RequestBody

/**
 * Author:    WuNan
 * Email:     wunan@barradata.com
 * Created:   2019/7/4 20:13
 **/
class Params : HashMap<String, Any>() {

    fun putUserName(username: String) {
        put("userName", username)
    }

    fun putPassword(password: String) {
        put("passWord", password)
    }

    fun putFileType(fileType: String) {
        put("fileType", fileType)
    }

    fun putUserUuid(uuid: String) {
        put("userUuid", uuid)
    }

    fun putAddressBookUuid(addressBookUuid:String){
        put("addressBookUuid",addressBookUuid)
    }

    fun putAuthPageCode(authPageCode: ApiService.AuthPageCode) {
        put("authPageCode", authPageCode.name.toLowerCase())
    }

    fun putDicType(dicType: ApiService.DictionaryType) {
        put("dictType", dicType.name.toLowerCase())
    }

    fun putChannel(channel: String) {
        put("channel", channel)
    }

    fun toJsonParam(): RequestBody {
        return ParamsFactory.getCommonParams(this)
    }

    fun toCommonParamStr(): String {
        return ParamsFactory.getCommonParamsStr(this)
    }

}